#include <iostream>
#include <sys/time.h>
#include <time.h>
#include "timeCnt.h"

int main(int argv, char**argc)
{

    TimeClickCnt tc;
    tc.startCnt();
    struct timeval tv;
    struct timezone tz;
    gettimeofday(&tv, &tz);
    printf("tv.sec: %ld\n",tv.tv_sec);
    printf("tv.us : %ld\n",tv.tv_usec);

    printf("tz.tz_dsttime: %d\n",tz.tz_dsttime);
    printf("tz.tz_minuteswest: %d\n",tz.tz_minuteswest);
    printf("%s", ctime(&tv.tv_sec));

    time_t timep;
    struct tm *p;

    time(&timep);
    p = localtime(&timep);

    printf("%d-%d-%d %d:%d:%d\n", (1900 + p->tm_year), ( 1 + p->tm_mon), p->tm_mday,
                                (p->tm_hour), p->tm_min, p->tm_sec);

    printf("%s\n", asctime(gmtime(&timep)));  //格林威治(GMT) 0时区

    printf("================================\n");
    tc.stopCnt();
    printf("================================\n");
    return 0;

}